package com.chuangsi.project.admin.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
* <p>
    * 订单表
    * </p>
*
* @author 
* @since 2023-03-23
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="Order对象", description="订单表")
@TableName("t_order")
    public class Order extends Model<Order> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "订单id")
    @TableId(value = "order_id", type = IdType.ASSIGN_UUID)
    @NotEmpty(message="订单id不能为空")
    @Size(max=32,message="订单id长度过长")
    private String orderId;

    @ApiModelProperty(value = "订单编号")
    @NotEmpty(message="订单编号不能为空")
    @Size(max=50,message="订单编号长度过长")
    private String orderNo;

    @ApiModelProperty(value = "支付订单id")
    @NotNull(message="支付订单id不能为空")
    private Long payOrderId;

    @ApiModelProperty(value = "产品id")
    private String productId;

    @ApiModelProperty(value = "部门id")
    @NotNull(message="部门id不能为空")
    private Long deptId;

    @ApiModelProperty(value = "合同模板id")
    @NotEmpty(message="合同模板id不能为空")
    @Size(max=32,message="合同模板id长度过长")
    private String agreementId;

    @ApiModelProperty(value = "印章id")
    @NotEmpty(message="印章id不能为空")
    @Size(max=32,message="印章id长度过长")
    private String sealId;

    @ApiModelProperty(value = "是否E签宝合同（Y:是 N:否）")
    @NotEmpty(message="是否E签宝合同不能为空")
    @Size(max=1,message="是否E签宝合同长度过长")
    private String esignContract;

    @ApiModelProperty(value = "客户id")
    private Long customerUserId;

    @ApiModelProperty(value = "客户名称")
    @NotEmpty(message="客户名称不能为空")
    @Size(max=30,message="客户名称长度过长")
    private String customName;

    @ApiModelProperty(value = "客户联系方式")
    @NotEmpty(message="客户联系方式不能为空")
    @Size(max=30,message="客户联系方式长度过长")
    private String customPhone;

    @ApiModelProperty(value = "客户身份证号")
    @NotEmpty(message="客户身份证号不能为空")
    @Size(max=18,message="客户身份证号长度过长")
    private String customIdCard;

    @ApiModelProperty(value = "新车发票价格")
    @Size(max=30,message="新车发票价格长度过长")
    private String carInvoicePrice;

    @ApiModelProperty(value = "车架号")
    @NotEmpty(message="车架号不能为空")
    @Size(max=17,message="车架号长度过长")
    private String vin;

    @ApiModelProperty(value = "发动机号")
    @NotEmpty(message="发动机号不能为空")
    @Size(max=20,message="发动机号长度过长")
    private String engineNo;

    @ApiModelProperty(value = "销售金额")
    private BigDecimal money;

    @ApiModelProperty(value = "产品类型（1.原厂代销，2.其他代销，3.传统）")
    @NotEmpty(message="产品类型（1.原厂代销，2.其他代销，3.传统）不能为空")
    @Size(max=1,message="产品类型（1.原厂代销，2.其他代销，3.传统）长度过长")
    private String type;

    @ApiModelProperty(value = "支付类型（1.全款，2.分期）")
    @NotEmpty(message="支付类型（1.全款，2.分期）不能为空")
    @Size(max=1,message="支付类型（1.全款，2.分期）长度过长")
    private String payType;

    @ApiModelProperty(value = "是否自己购买（1.是  2否）")
    private Integer ourselfBuy;

    @ApiModelProperty(value = "是否赠送权益（1.是  2否）")
    private Integer giftRights;

//    @ApiModelProperty(value = "是否开发票（1是 2否）")
//    private Integer issueInvoice;

    @ApiModelProperty(value = "申请发票状态（1.未申请 2.已申请 3.已开具）")
    private Integer invoiceStatus;

    @ApiModelProperty(value = "开票金额")
    private BigDecimal invoiceMoney;

    @ApiModelProperty(value = "开票时间")
    private LocalDate invoiceDate;

    @ApiModelProperty(value = "发票抬头")
    private String invoiceHeader;

    @ApiModelProperty(value = "单位税号")
    private String socialCreditCode;

    @ApiModelProperty(value = "开户银行")
    private String openingBank;

    @ApiModelProperty(value = "银行账号")
    private String accountNumber;

    @ApiModelProperty(value = "电话")
    private String phone;

    @ApiModelProperty(value = "地址")
    private String address;

    @ApiModelProperty(value = "发票uris(用,隔开)")
    private String invoiceUris;

    @ApiModelProperty(value = "发票备注")
    private String invoiceRemark;

    @ApiModelProperty(value = "合同详情")
    @NotEmpty(message="合同详情不能为空")
    @Size(max=500,message="合同详情长度过长")
    private String agreementDetail;

    @ApiModelProperty(value = "自定义字段（json格式）")
    @NotEmpty(message="自定义字段（json格式）不能为空")
    private String selfField;

    @ApiModelProperty(value = "销售员id")
    @NotNull(message="销售员id不能为空")
    private Long userId;

    @ApiModelProperty(value = "审核状态（1.待审核，2.通过，3.已驳回，4.申请退保，5.已退保 6.退保驳回）")
    @NotEmpty(message="审核状态（1.待审核，2.通过，3.已驳回，4.申请退保，5.已退保 6.退保驳回）不能为空")
    @Size(max=1,message="审核状态（1.待审核，2.通过，3.已驳回，4.申请退保，5.已退保 6.退保驳回）长度过长")
    private String appStatus;

    @ApiModelProperty(value = "电子签名图片uri")
    private String signUri;

    @ApiModelProperty(value = "文件地址（适用于不是E签宝合同）")
    private String filePath;

    @ApiModelProperty(value = "文件id（用于E签宝）")
    private String fileId;

    @ApiModelProperty(value = "签署流程id")
    private String signFlowId;

    @ApiModelProperty(value = "订单备注")
    private String remark;

    @ApiModelProperty(value = "是否删除（0：未删除 1：已删除）")
    private Integer delFlag;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @NotNull(message="创建时间不能为空")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @NotNull(message="修改时间不能为空")
    private LocalDateTime updateTime;


    @Override
    public Serializable pkVal() {
        return this.orderId;
    }

}
